﻿package core.object {
	import flash.display.Sprite;
	import core.GameContainer;

    public class Flyer extends Sprite {

        private var bug:GameAnimation;
        private var _process:int;
        private var _angle:Number;
        private var _onRoad:Boolean;
        private var _line:int;

        public function Flyer(){
            this.init();
        }
        private function init():void{
            this.bug = new GameAnimation(31,false);
			this.bug.x = -this.bug.width / 2;
			this.bug.y = -this.bug.height / 2;
            addChild(this.bug);
        }
		
        public function set process(value:Number):void{
            if (value > (GameContainer.MapData[this._line].length - 1)){
                value = (GameContainer.MapData[this._line].length - 1);
            };
            this._process = value;
            this.showProcess();
        }
		
        public function get process():Number{
            return (this._process);
        }
		
        private function showProcess():void{
            var list:Array = GameContainer.MapData[this._line][this._process];
            this.x = list[0];
            this.y = list[1];
            this._angle = list[2];
            this.rotation = ((this._angle * GameBall.toAngle) + 90);
        }
        public function set line(value:int):void{
            this._line = value;
        }
        public function get line():int{
            return (this._line);
        }
        public function set angle(value:Number):void{
            this._angle = value;
            this.rotation = ((this._angle * GameBall.toAngle) + 90);
        }
        public function get angle():Number{
            return (this._angle);
        }
        public function set onRoad(value:Boolean):void{
            this._onRoad = value;
        }
        public function get onRoad():Boolean{
            return (this._onRoad);
        }

    }
}
